home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / 422mods.zip / AFG_TCLR.422 < prev    next >
Text File  |  1993-04-07  |  4KB  |  143 lines

  1. COLORS.MOD puts colors anywhere
  2. The False Prophet #604 @12456
  3. 3Wednesday, March 31, 1993  1 7:41 am
  4. R
  5.  
  6. 28/43: AFG_TCLR.MOD
  7. Name: Alken Foijet Godden #1 @8860 [S. Pasadena, CA]
  8. Date: Mon Aug 24 21:59:43 1992
  9. From: Waterfall [GSA] (Southern California) [818-799-3544]
  10.  
  11. Mod Name   :  AFG_TCLR.MOD
  12. Writer     :  Alken Foijet Godden
  13. WWIV ver   :  WWIVv421... should work with any though.
  14. Description:  Allows colors almost anywhere {titles, etc.}.
  15.  
  16.     Ok, here's what this mod "really" does:  Allow you to put colors
  17. everywhere!  Be a bit carefull when using this mod to have colors in places
  18. that are dependant on alignnment (EX: in //BOARDEDIT your subs will tend to
  19. get out of alignment when you add color the the sub names).
  20.     You'll be able to put color in your voting questions and answers, sub
  21. names, directory names, G-File names, message titles, etc...  If you have
  22. fancy boxes around what you want colorize I suggest that you use wherex() and
  23. wherey() to help with your alignment in that area.
  24.  
  25.  
  26. Replace the following void with the one that's in COM.C and compile... 
  27.  
  28. -----------------------------------------------------------------------
  29.  
  30. void input1(char *s, int maxlen, int lc, int crend)
  31. /* This will input a line of data, maximum maxlen characters long, terminated
  32.  * by a C/R.  if (lc) is non-zero, lowercase (and color) is allowed,
  33.  * otherwise all characters are converted to uppercase.
  34.  */
  35. {
  36.   int curpos=0, done=0, in_ansi=0, colorcheck=0;
  37.   unsigned char ch;
  38.  
  39.   while (!done && !hangup) {
  40.     ch = getkey();
  41.     if (in_ansi) {
  42.       if ((in_ansi==1) && (ch!='['))
  43.         in_ansi=0;
  44.       else {
  45.         if (in_ansi==1)
  46.           in_ansi=2;
  47.         else if (((ch<'0') || (ch>'9')) && (ch!=';'))
  48.           in_ansi=3;
  49.         else
  50.           in_ansi=2;
  51.       }
  52.     }
  53.     if (!in_ansi) {
  54.       if (ch > 31) {
  55.         if (curpos < maxlen) {
  56.           if (!lc)
  57.             ch = upcase(ch);
  58.           if (colorcheck==0) {
  59.             s[curpos++] = ch;
  60.             outchr(ch);
  61.           } else if (ch<58 && ch>47) {
  62.                         s[curpos++] = ch;
  63.             outchr(ch);
  64.             colorcheck=0;
  65.           } else {
  66.             backspace();
  67.             curpos--;
  68.             colorcheck=0;
  69.           }
  70.         }
  71.       } else
  72.         switch(ch) {
  73.           case 14:
  74.           case 13:
  75.             s[curpos] = 0;
  76.             done = echo = 1;
  77.             if (crend)
  78.               nl();
  79.             break;
  80.           case 16: /* Ctrl-P */
  81.             if (curpos < maxlen && lc==1) {
  82.               ch = 3;
  83.               s[curpos++] = ch;
  84.               colorcheck = 1;
  85.               outchr(ch);
  86.             }
  87.             break;
  88.           case 23: /* Ctrl-W */
  89.             if (curpos) {
  90.               do {
  91.                 curpos--;
  92.                 backspace();
  93.                 if (s[curpos]==26)
  94.                   backspace();
  95.               } while ((curpos) && (s[curpos-1]!=32));
  96.             }
  97.             break;
  98.           case 26:
  99.             if (input_extern) {
  100.               s[curpos++] = 26;
  101.               outstr("^Z");
  102.             }
  103.             break;
  104.           case 8:
  105.             if (curpos) {
  106.               if (s[curpos-2]==3) {
  107.                 curpos--;
  108.                 curpos--;
  109.                 break;
  110.               }
  111.               curpos--;
  112.               backspace();
  113.               if (s[curpos] == 26)
  114.                 backspace();
  115.             }
  116.             break;
  117.           case 21:
  118.           case 24:
  119.             while (curpos) {
  120.               curpos--;
  121.               backspace();
  122.               if (s[curpos] == 26)
  123.                 backspace();
  124.             }
  125.             break;
  126.           case 27:
  127.             in_ansi=1;
  128.             break;
  129.         }
  130.     }
  131.     if (in_ansi==3)
  132.       in_ansi=0;
  133.   }
  134.   if (hangup)
  135.     s[0] = 0;
  136. }
  137.  
  138. --------------------------------------------------------------------
  139. Yep, it's that simple... enjoy.
  140.  
  141.                         Ωlkën
  142.                              Fσíjeτ
  143.